/******************************************************************************
 * * utility.h - utilities function declaration
 *
 * *(C) Copyright 2019 Asr International Ltd.
 * * All Rights Reserved
 * ******************************************************************************/
#ifndef UTILITY_H
#define UTILITY_H

#ifdef __cplusplus
extern "C" {
#endif

#include "ui_type.h"
#include "../../lvgl/hal/hal.h"

#define FEBRUARY       2
#define STARTOFTIME    1970
#define SECDAY         86400L                                           // seconds per day
#define SECYR          (HAL_RTC_SECDAY * 365)                           // seconds per year

extern VOID UI_Seconds_to_Time(INT32 tim, hal_rtc_t *tm);
extern UINT32 UI_Time_to_Seconds(const hal_rtc_t *tm);
extern UINT32 UI_Get_Timestamp_In_Second(VOID);
extern UINT8 UI_Rtc_Calc_Weekday(hal_rtc_t *tm);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /*UTILITY_H*/
